<?php
	include_once("DataProvider.php");
	include_once("../DTO/hangSXDTO.php");
	
	class hangSXDAO
	{
		public $sql = "";
		var $hangSXDTO;
		function __construct()
		{
			return $this->hangSXDTO = new hangSXDTO();
		}
		
		public function load()
		{
			$result= DataProvider::ExecuteQuery($this->sql);
			$arrHangSXDTO = new ArrayObject();
			
			while($row = mysql_fetch_array($result))
			{
				$hangSXDTO = new hangSXDTO();
				$hangSXDTO->idHangSX = $row['idHangSX'];
				$hangSXDTO->tenHangSX = $row['tenHangSX'];
				$hangSXDTO->biXoa = $row['biXoa'];
				
				$arrHangSXDTO[] = $hangSXDTO;
			}
			return $arrHangSXDTO;
		}
		
		public function load_HangSX_All()
		{
			$this->sql= 'select * from hangsx';
			$result=$this->load();
			return $result; 
		}
		
		public function load_HangSX_One($idHangSX)
		{
			$this->sql = 'select * from hangsx where idHANGSX ='.$idHangSX;
			$result = $this->load();
			return $result;
		}
	
		public function load_HangSX()
		{
			$this->sql ='select * from hangsx where biXoa=0';
			$result = $this->load();
			return $result;
		}
		
	}
	
?>